package org.jetlinks.pro.things;

import org.jetlinks.core.message.HeaderKey;
import org.jetlinks.core.things.ThingType;
import org.jetlinks.pro.PropertyConstants;
import org.jetlinks.pro.utils.TopicUtils;

import java.util.Collections;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentSkipListSet;

public interface ThingConstants {

    HeaderKey<Map<String,Object>> contextVar = PropertyConstants.Key.of("_var", ConcurrentHashMap::new);
    HeaderKey<Set<String>> connectorTrace =  PropertyConstants.Key.of("_connectors", ConcurrentSkipListSet::new);

    interface Topics {

        static String properties() {
            return "/thing/*/property/*";
        }

        static String[] properties(ThingType thingType, String thingId) {

            return new String[]{
                thingType.getTopicPrefix("*", thingId) + "/message/property/report",
                thingType.getTopicPrefix("*", thingId) + "/message/property/read/reply",
                thingType.getTopicPrefix("*", thingId) + "/message/property/write/reply",

            };
        }


    }


}
